﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KalenderTradisional
{
    class Masehi
    {
        /*private int hari;
        private int tanggal;
        private int bulan;
        private int tahun;*/
        private string hariMas;
        private string tanggalMas;
        private string bulanMas;
        private string tahunMas;

        private DateTime kalender;

        public Masehi(int tahun,int bulan,int tanggal)
        {
            kalender = new DateTime(tahun, bulan, tanggal);
            setKalender(tahun, bulan, tanggal, (int)kalender.DayOfWeek);            
        }

        public string getHari()
        {
            return this.hariMas;
        }

        public string getTanggal()
        {
            return this.tanggalMas;
        }

        public string getBulan()
        {
            return this.bulanMas;
        }

        public string getTahun()
        {
            return this.tahunMas ;
        }

        public void setKalender(int tahun, int bulan, int tanggal, int hari)
        {
            setTanggal(tanggal);
            setHari(hari);
            setBulan(bulan);
            setTahun(tahun);
        }

        public void setHari(int val)
        {
            switch (val)
            {
                case 0: this.hariMas = "MINGGU"; break;
                case 1: this.hariMas = "SENIN"; break;
                case 2: this.hariMas = "SELASA"; break;
                case 3: this.hariMas = "RABU"; break;
                case 4: this.hariMas = "KAMIS"; break;
                case 5: this.hariMas = "JUMAT"; break;
                case 6: this.hariMas = "SABTU"; break;
                default: this.hariMas = ""; break;
            }
        }

        public void setTanggal(int val)
        {            
            int tamp;
            tamp = val;
            if (tamp >= 1 && tamp <= 9)
            {
                this.tanggalMas = "0" + tamp;
            }
            else
            {
                this.tanggalMas = "" + tamp;
            }            
        }

        public void setBulan(int val)
        {            
            switch (val)
            {
                case 1: this.bulanMas = "JANUARI"; break;
                case 2: this.bulanMas = "FEBRUARI"; break;
                case 3: this.bulanMas = "MARET"; break;
                case 4: this.bulanMas = "APRIL"; break;
                case 5: this.bulanMas = "MEI"; break;
                case 6: this.bulanMas = "JUNI"; break;
                case 7: this.bulanMas = "JULI"; break;
                case 8: this.bulanMas = "AGUSTUS"; break;
                case 9: this.bulanMas = "SEPTERMBER"; break;
                case 10: this.bulanMas = "OKTOBER"; break;
                case 11: this.bulanMas = "NOVEMBER"; break;
                case 12: this.bulanMas = "DESEMBER"; break;
                default: this.bulanMas = ""; break;
            }
        }

        public void setTahun(int val)
        {
            this.tahunMas = val.ToString();
        }
    }
}
